package com.xbongbong.saas.enums.dictionary;

import com.xbongbong.i18n.util.I18nMessageUtil;
import lombok.Getter;

import java.util.Objects;

/**
 * @author ruansicheng
 * @className KnowledgeDataStatusEnum
 * @description
 * @date 2022/06/29   14:41
 */
@Getter
public enum KnowledgeContentTypeEnum {
    // 类型

    TEXT(100, "enum.KnowledgeContentType.name.text"),
    IMAGE(200, "enum.KnowledgeContentType.name.image"),
    VIDEO(300, "enum.KnowledgeContentType.name.video"),
    MATERIAL_LIBRATY(4, "enum.KnowledgeContentTyp.name.material_libraty"),
    ;

    private Integer code;
    private String name;

    KnowledgeContentTypeEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }


    public static String getByCode(Integer number) {
        for (KnowledgeContentTypeEnum knowledgeContentTypeEnum : values()) {
            if (Objects.equals(knowledgeContentTypeEnum.getCode(), number)) {
                return knowledgeContentTypeEnum.getName();
            }
        }
        return "";
    }

    public String getName() {
        return I18nMessageUtil.getMessage(name);
    }
}
